// Call DLL.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "../Array_Multiply.h"
#include <stdio.h>

int main(int argc, char* argv[])
{
	TD1Hdl handle_var;
	TD1Hdl handle_var2;

	// use DSNewHandle instead of malloc to allocate memory
	handle_var = (TD1**)DSNewHandle(sizeof(TD1));
	handle_var2 = (TD1**)DSNewHandle(sizeof(TD1));

	// initialize sizes
	(*handle_var)->dimSize = 1;
	(*handle_var2)->dimSize = 1;

	// initialize values of 1st elements
	(*handle_var)->Numeric[0] = 1;
	(*handle_var2)->Numeric[0]= 1234;

	printf("Before call to DLL:\t%f\n\n", (*handle_var2)->Numeric[0]);
	
	// the DLL multiplies each element of the input array by 2 and passes
	//   that value to the corresponding index of the output array
	Array_Multiply(&handle_var, &handle_var2);
	
	printf("After call to DLL:\t%f\n\n", (*handle_var2)->Numeric[0]);
	
	return 0;
}